package com.ontheroad.mysql.Qiniuyun.service;

import com.ontheroad.core.util.Auth;
import com.ontheroad.qiniu.service.QiniuyunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service;

/**
 * Created by kedong on 2017/8/9 0009.
 */
@Service
public class QiniuyunServiceImpl implements QiniuyunService {

//    @Autowired
//    private MessageSource messageSource;

    @Value("${qiniuyun.AccessKey}")
    private String AccessKey;
    @Value("${qiniuyun.SecretKey}")
    private String SecretKey;
    @Value("${qiniuyun.bucket}")
    private String bucket;
    @Value("${qiniuyun.url}")
    private String url;

    @Override
    public Auth createAuth() {
        return Auth.create(AccessKey, SecretKey);
    }

    @Override
    public String getUploadToken() {
        Auth auth = createAuth();
        return auth.uploadToken(bucket);
    }

    @Override
    public String getDomain() {
        return url;
    }


}
